package edu.uis.csc478.spring09.threeoxen.application;

import javax.swing.*;
import java.awt.event.ActionListener;
import java.awt.*;

/**
 * User: Chris Logan
 * Date: Apr 15, 2009
 * Time: 3:13:12 PM
 */
public abstract class BaseDialog extends JDialog {

    protected JDialog createNewDialog(String className, boolean alwaysOnTop) throws ApplicationException {
        JDialog dialog = null;
        try {
            dialog = (JDialog) Class.forName(className).newInstance();
        } catch(Exception e) {
            e.printStackTrace();
            //throw new ApplicationException("Unable to create dialog for " + className, e);
        }
        dialog.pack();
        dialog.setAlwaysOnTop(alwaysOnTop);
        dialog.setVisible(true);
        return dialog;
    }

    protected void showMessageDialog(Component source, String message) {
        JOptionPane.showMessageDialog(source, message);
    }

}
